package com.itheima.api.object.demo01;

/**
 * Student类默认是继承Object类的，那么我们后期就可以去创建Student的对象，然后去调用Object类的方法
 */
public class Student {

    private String name ;       // 姓名

    private int age ;           // 年龄

    public Student(){

    }

    public Student(String name , int age) {
        this.name = name ;
        this.age = age ;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        if (age != student.age) return false;
        return name != null ? name.equals(student.name) : student.name == null;
    }

}
